package com.androidx.p013lv.base.utils;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.androidx.p013lv.base.BaseSdk;

/* renamed from: com.androidx.lv.base.utils.NetUtil */
public class NetUtil {
    public static boolean isNetworkConnected() {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) BaseSdk.getContext().getSystemService("connectivity")).getActiveNetworkInfo();
        if (activeNetworkInfo != null) {
            return activeNetworkInfo.isAvailable();
        }
        return false;
    }

    public static boolean isWifiConnected() {
        NetworkInfo networkInfo = ((ConnectivityManager) BaseSdk.getContext().getSystemService("connectivity")).getNetworkInfo(1);
        if (networkInfo != null) {
            return networkInfo.isAvailable();
        }
        return false;
    }

    public static boolean isMobileConnected() {
        NetworkInfo networkInfo = ((ConnectivityManager) BaseSdk.getContext().getSystemService("connectivity")).getNetworkInfo(0);
        if (networkInfo != null) {
            return networkInfo.isAvailable();
        }
        return false;
    }

    public static int getConnectedType() {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) BaseSdk.getContext().getSystemService("connectivity")).getActiveNetworkInfo();
        if (activeNetworkInfo == null || !activeNetworkInfo.isAvailable()) {
            return -1;
        }
        return activeNetworkInfo.getType();
    }

    public static boolean isNetworkAvailable() {
        NetworkInfo[] allNetworkInfo;
        ConnectivityManager connectivityManager = (ConnectivityManager) BaseSdk.getContext().getSystemService("connectivity");
        if (!(connectivityManager == null || (allNetworkInfo = connectivityManager.getAllNetworkInfo()) == null)) {
            for (NetworkInfo networkInfo : allNetworkInfo) {
                if (networkInfo.getState() == NetworkInfo.State.CONNECTED) {
                    return true;
                }
            }
        }
        return false;
    }
}
